<?php

error_reporting(0);
// Define path to application directory
defined('APPLICATION_PATH')
        || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
            realpath(APPLICATION_PATH . '/../../BIBLIOTEKI/'),
    
     realpath(APPLICATION_PATH . '/../library/'),
            realpath(APPLICATION_PATH . '/../application/managers/'),
            realpath(APPLICATION_PATH . '/../application/managers/default/'),
            realpath(APPLICATION_PATH . '/../application/forms/'),
            realpath(APPLICATION_PATH . '/../application/forms/default/'),
            realpath(APPLICATION_PATH . '/../application/layouts/'),
            realpath(APPLICATION_PATH . '/../application/models/'),
            realpath(APPLICATION_PATH . '/../application/routers/'),
            realpath(APPLICATION_PATH . '/../application/configs/'),
            get_include_path(),
        )));

// Autoloading
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);

$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true); //--> dla celów debugowania
$router = $frontController->getRouter();

include_once 'defaultRouters.php';


$frontendOptions = array(
    'automatic_serialization' => true
);

$backendOptions = array(
    'cache_dir' => '../cache'
);

$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);


/** Zend_Application */
//require_once 'Zend/Application.php';  
// Create application, bootstrap, and run

$application = new Zend_Application(
                APPLICATION_ENV,
                APPLICATION_PATH . '/configs/application.ini'
);

Zend_Session::start();
//Zend_Session::start();

$application->bootstrap()
        ->run();

